package com.zc.study.designPattern.创建型设计模式.singletonPattern;

public class test {
    public static void main(String[] args) {
        MyObject myObject=MyObject.getInstance();
        myObject.setId(1);
        System.out.println(myObject.getId());
        //判断是否是唯一单例
        TheBestForJava s1 =  TheBestForJava.getInstance();
        TheBestForJava s2 = TheBestForJava.getInstance();
        if(s1 == s2){
            System.out.println("singleton yes");
        }else{
            System.out.println("singleton no");
        }

    }
}
